package com.jiangjun.fetch.servlet;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class Start implements ServletContextListener {

	public static String img_server = "";
	public static String txt_server = "";
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {

		InputStream is = null;
		try {
			is = Start.class.getClassLoader().getResourceAsStream(
					"config.properties");
			Properties p = new Properties();
			p.load(is);
			img_server = p.getProperty("img_server");
			txt_server = p.getProperty("txt_server");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (is != null) {
				try {
					is.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
